package com.cy.basic;

import org.omg.CORBA.Object;

import javax.naming.Name;
import java.io.File;
import java.util.Arrays;
import java.util.List;

public class HelloWorld {
    public static void main(String[] args) {
        for (int i = 0; i < 5; i++) {
            new UseSingle().start();
        }
    }
}

class UseSingle extends Thread{
    @Override
    public void run() {
        SingleLazy singleLazy=SingleLazy.get();
        System.out.println(singleLazy);
    }
}

class SingleLazy{
    private static SingleLazy singleLazy;
    public static synchronized SingleLazy get(){
        if(singleLazy==null){
            for (int i = 0; i < 1000; i++) {
                for (int j = 0; j < 1000; j++) {
                    for (int k = 1; k < 1000; k++) {
                        int x=i*j/k;
                    }
                }
            }
            singleLazy=new SingleLazy();
            return singleLazy;
        }else {
            return singleLazy;
        }
    }
}